import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { NameChildrenVO, NameChildrenForm, NameChildrenQuery } from '@/api/genealogy/nameChildren/types';

/**
 * 查询子女信息列表
 * @param query
 * @returns {*}
 */

export const listNameChildren = (query?: NameChildrenQuery): AxiosPromise<NameChildrenVO[]> => {
  return request({
    url: '/genealogy/nameChildren/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询子女信息详细
 * @param id
 */
export const getNameChildren = (id: string | number): AxiosPromise<NameChildrenVO> => {
  return request({
    url: '/genealogy/nameChildren/' + id,
    method: 'get'
  });
};

/**
 * 新增子女信息
 * @param data
 */
export const addNameChildren = (data: NameChildrenForm) => {
  return request({
    url: '/genealogy/nameChildren',
    method: 'post',
    data: data
  });
};

/**
 * 修改子女信息
 * @param data
 */
export const updateNameChildren = (data: NameChildrenForm) => {
  return request({
    url: '/genealogy/nameChildren',
    method: 'put',
    data: data
  });
};

/**
 * 删除子女信息
 * @param id
 */
export const delNameChildren = (id: string | number | Array<string | number>) => {
  return request({
    url: '/genealogy/nameChildren/' + id,
    method: 'delete'
  });
};
